
@echo off  
setlocal enabledelayedexpansion 
:: 设置字符集为UTF-8，这将会使得控制台能够正确显示中文字符。
chcp 65001  
:: 设置源文件夹和目标文件夹  
set "source_folder=." 

::检测model路径
set "destination_folder=E:\workspace\temp\model"
::软件根目录
set folder_saftware=%destination_folder%/bin

:: 检查目标文件夹是否存在，如果不存在则创建  
if not exist %destination_folder% (
    ::mkdir %destination_folder%
    ::echo Folder created successfully.
	echo Folder not exist.
	endlocal  
	pause
	exit()
) else (
    echo Folder already exists.
)

xcopy %source_folder%   %destination_folder% /I /E /Y
  

echo start copy bin to saftware ......
pause


:: 检查目标文件夹是否存在，如果不存在则创建  
if not exist %folder_saftware% (
    ::mkdir %destination_folder%
    ::echo Folder created successfully.
	echo %folder_saftware%
	echo Folder not exist.
	endlocal  
	pause
	exit()
) else (
    echo Folder already exists.
)


set sourcebin_folder=%source_folder%/bin
xcopy "%sourcebin_folder%" "%folder_saftware%\"  /E /Y

endlocal  
pause
exit 0
  
  
 
  

pause
exit 0




:: 获取当前日期和时间，用于创建备份文件夹  
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"  
set "YY=!dt:~2,2!" & set "YYYY=!dt:~0,4!" & set "MM=!dt:~4,2!" & set "DD=!dt:~6,2!"  
set "HH=!dt:~8,2!" & set "Min=!dt:~10,2!" & set "Sec=!dt:~12,2!"  
set "backup_folder=%destination_folder%\%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%" 
echo "%backup_folder%"

:: 创建备份文件夹  
mkdir "!backup_folder!"  
  
:: 执行备份操作，使用xcopy命令复制文件夹及其内容  
xcopy /E /I /Y "%source_folder%" "!backup_folder!\"  
  
:: 输出备份完成消息  
echo Backup completed: !backup_folder!  






